home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr48 / tsbat146.zip / GFIND.BAT < prev    next >
DOS Batch File  |  1993-04-13  |  3KB  |  100 lines

  1. @echo off
  2.  
  3. rem A trivial MsDos batch to find files from the Garbo indexes
  4. rem
  5. rem Some users have wished that Garbo would have an index like SIMTEL20
  6. rem giving the directory, filesize, and file information. You can use
  7. rem this quick and dirty batch to get information in that format.
  8.  
  9. echo ┌─────────────────────────────────────────────────┐
  10. echo │ Find files from the Garbo indexes               │
  11. echo │ By Prof. Timo Salmi, ts@uwasa.fi, Tue 13-Apr-93 │
  12. echo └─────────────────────────────────────────────────┘
  13.  
  14. if "%1"=="" goto _help
  15.  
  16. rem ┌─────────────────────────────────────────────────────────────┐
  17. rem │ Edit here where you have your own corresponding index files │
  18. rem └─────────────────────────────────────────────────────────────┘
  19. set ind1_=d:\_file.lst
  20. set ind2_=d:\_dir.lst
  21. set ind3_=c:\chyde\index
  22.  
  23. if exist %ind1_% goto _2
  24. echo File %ind1_% not found
  25. goto _out
  26.  
  27. :_2
  28. if exist %ind1_% goto _3
  29. echo File %ind1_% not found
  30. goto _out
  31.  
  32. :_3
  33. if exist %ind1_% goto _4
  34. echo File %ind1_% not found
  35. goto _out
  36.  
  37. :_4
  38. rem Check that MsDos find.exe is available at path or current directory
  39. set found_=no
  40. if exist find.exe set found_=yes
  41. for %%d in (%path%) do if exist %%dfind.exe set found_=yes
  42. for %%d in (%path%) do if exist %%d\find.exe set found_=yes
  43. if "%found_%"=="yes" goto _5
  44. echo MsDos file find.exe not found at path or current directory
  45. goto _out
  46.  
  47. :_5
  48. rem Check if grep.com is available at path or current directory
  49. rem Else use MsDos find.exe
  50. set found_=no
  51. if exist grep.com set found_=yes
  52. for %%d in (%path%) do if exist %%dgrep.com set found_=yes
  53. for %%d in (%path%) do if exist %%d\grep.com set found_=yes
  54. if not "%found_%"=="yes" goto _usefind
  55.  
  56. rem Find the information with grep.com
  57. grep %1 %ind1_%> garbo$$$
  58. grep %1 %ind2_%>> garbo$$$
  59. grep ^%1 %ind3_%>> garbo$$$
  60. find "%1" garbo$$$
  61. goto _out
  62.  
  63. :_usefind
  64. rem Find the information with MsDos find.exe
  65. find "%1" %ind1_%> garbo$$$
  66. find "%1" %ind2_%>> garbo$$$
  67. find "%1" %ind3_%>> garbo$$$
  68. find "%1" garbo$$$
  69. goto _out
  70.  
  71. :_help
  72. echo.
  73. echo This is a highly specialized batch for combining the information
  74. echo from Garbo MsDos FTP archives file index files INDEX.ZIP, _dir.zip
  75. echo and _file.zip.
  76. echo.
  77. echo Usage: GFIND [filename]
  78. echo.
  79. echo The end of the file name need not be complete, only the beginning.
  80. echo  Example:
  81. echo   GFIND tsutil   #This is ok
  82. echo   GFIND sutil37  #This will match only partially, but gets you going
  83. echo.
  84. echo The batch uses GREP.COM if you have such a utility. If you don't the
  85. echo the ordinary MsDos FIND.EXE is used instead, but then then the
  86. echo filename is matched from anywhere of the INDEX file lines.
  87. echo.
  88. echo GFIND is also available in Unix format as garbo.uwasa.fi:/unix/ts/gfind
  89. echo.
  90. echo Before using the first time, make the ind*_ environment variables in
  91. echo the batch to point to where you have the relevant file index files.
  92. goto _out
  93.  
  94. :_out
  95. if exist garbo$$$ del garbo$$$
  96. set ind1_=
  97. set ind2_=
  98. set ind3_=
  99. set found_=
  100.